package net.lateeye.search;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import net.lateeye.util.MediaProperties;
import net.lateeye.util.NoValueSpecifiedException;

/**
 * must be abstract class. 2008Feb29/130s
 * 
 * @author Isao Isaac Saito <130s@lateeye.net>
 * 
 */
public abstract class SearchenginePropsImpl extends MediaProperties implements
		SearchengineProps
// 10May25/130s. No reason for extending SimpleMediawareProps
// public class SearchenginePropsImpl extends SimpleMediawareProps implements
{
	// public Properties props = null; //10May25/130. Not used.

	private static final String MSG_ERR_RESULT_IN_SINGLEPAGE = "You should not keep "
			+ PROPKEY_VAL_NUMOFRESULTS_SINGLEPAGE
			+ "blank. i.e. 20 works in general.";

	public SearchenginePropsImpl(String path)
	// throws InvalidPropertiesFormatException // 1/1/10/130s) Toggled since
			// InvalidPropertiesFormatException should be used for different
			// purpose (XML related. See javadoc)
			throws NoValueSpecifiedException
	{
		try {
			super.load(new FileInputStream(path));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			System.err.println("The setting file " + path
					+ " not found. Make sure the file exists.");
		} catch (IOException e) {
			e.printStackTrace();
		}
		try {
			this.getProperty(PROPKEY_VAL_NUMOFRESULTS_SINGLEPAGE);
		} catch (NoValueSpecifiedException e) {
			// throw new InvalidPropertiesFormatException(
			// MSG_ERR_RESULT_IN_SINGLEPAGE);
			throw e;
		}
	}
}
